---
title: Custom Domain/Authentication
description: Customize the preview proxy with your own domain and logic.
---

Daytona allows you to deploy your own custom preview proxy to handle preview URLs for sandboxes. This gives you complete control over the preview experience, including custom domains, authentication, error handling, and styling.

**What you can do with a custom preview proxy:**

- **Custom Domain:** Host your proxy under your own domain (e.g., `preview.yourcompany.com`)
- **User Authentication:** Implement custom authentication logic for private previews
- **Smart Sandbox Management:** Automatically start stopped sandboxes before forwarding users
- **Custom Error Pages:** Style error pages to match your brand
- **Preview Warning Control:** Disable Daytona's preview warning
- **CORS Management:** Override Daytona's default CORS settings

---

## How It Works

When a user visits a preview URL, your custom proxy receives the request and can:

1. **Authenticate the user** using custom logic
2. **Check sandbox status** and start it if needed
3. **Forward the request** to the actual sandbox
4. **Handle responses** with custom styling and error pages
5. **Send custom headers** to control Daytona's behavior

---

## Daytona Headers

Your proxy can send special headers to control Daytona's behavior:

#### Disable Preview Warning

To disable Daytona's preview warning page, send:

```
X-Daytona-Skip-Preview-Warning: true
```

#### Disable CORS

To override Daytona's default CORS settings, send:

```
X-Daytona-Disable-CORS: true
```

### Disable Last Activity Update

To prevent sandbox last activity updates when previewing, you can set the `X-Daytona-Skip-Last-Activity-Update` header to `true`.
This will stop Daytona from keeping sandboxes, that have [auto-stop enabled](/docs/sandbox-management#auto-stop-interval), started:

```bash
curl -H "X-Daytona-Skip-Last-Activity-Update: true" \
https://3000-sandbox-123456.proxy.daytona.work
```

### Authentication

For private preview links, users should send:

```
X-Daytona-Preview-Token: {sandboxToken}
```

The `sandboxToken` can be fetched through the [Daytona SDK or API](/docs/en/preview-and-authentication).

---

## Examples

You can find examples of custom preview proxies on our [Github](https://github.com/daytonaio/daytona-proxy-samples):

- [Typescript Example](https://github.com/daytonaio/daytona-proxy-samples/tree/main/typescript)
- [Golang Example](https://github.com/daytonaio/daytona-proxy-samples/tree/main/go)
